import request from '../utils/request';

// 获取所有设备
export function getDevices() {
  return request({
    url: '/devices',
    method: 'get'
  });
}

// 根据 ID 获取设备
export function getDeviceById(id) {
  return request({
    url: `/devices/${id}`,
    method: 'get'
  });
}

// 添加新设备
export function addDevice(deviceInfo) {
  return request({
    url: '/devices',
    method: 'post',
    data: deviceInfo
  });
}

// 更新设备信息
export function updateDevice(deviceInfo) {
  return request({
    url: '/devices',
    method: 'put',
    data: deviceInfo
  });
}

// 删除设备
export function deleteDevice(id) {
  return request({
    url: `/devices/${id}`,
    method: 'delete'
  });
}
